/*
 *
 * @ProjectName:    my_umi_app
 * @Package:
 * @ClassName:      message_api
 * @Description:    留言
 * @Author:         SuPeiSen
 * @CreateDate:     2021/3/2 11:26 上午
 * @UpdateDate:     2021/3/2 11:26 上午
 * @UpdateRemark:   更新说明：
 * @Version:        1.0
 */

import { Requests } from '@/utils/requests';
import { BlogApiPath } from '@/config/api_config';
import {
  BlogMessageItemType,
  BlogMessageListType,
} from '@/type/blog/message_type';

/**
 * 博客留言
 * @param param
 * @constructor
 */
export const BlogSentMessageApi = async (param: any) => {
  return await Requests.defaults.httpNo('post', BlogApiPath.blogSentMessage, {
    postData: param,
  });
};

/**
 * 通过文章id获取对应的留言
 * @param article_id
 * @constructor
 */
export const BlogGetMessageListApi = async (article_id: number) => {
  return await Requests.defaults.httpNo<Array<BlogMessageItemType>>(
    'get',
    BlogApiPath.blogGetMessageListById,
    {
      getData: { article_id: article_id },
    },
  );
};

/**
 * 通过文章id获取对应的留言
 * @param article_id
 * @constructor
 */
export const BlogGetBlogMessageListApi = async () => {
  return await Requests.defaults.httpNo<Array<BlogMessageItemType>>(
    'get',
    BlogApiPath.blogGetBlogMessageListById,
  );
};
